<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * 68KB
 *
 * An open source knowledge base script
 *
 * @package		68kb
 * @author		68kb Dev Team
 * @copyright	Copyright (c) 2009, 68 Designs, LLC
 * @license		http://68kb.com/user_guide/license.html
 * @link		http://68kb.com
 * @since		Version 1.0
 */

// ------------------------------------------------------------------------

/**
 * KB Controller
 *
 * Main Setup Controller
 *
 * @package		68kb
 * @subpackage	Migrations
 * @category	Migrations
 * @author		68kb Dev Team
 * @link		http://68kb.com/
 * @version 	$Id: kb.php 125 2009-11-15 05:15:57Z suzkaw68 $
 */
class Alter_settings
{
	// ------------------------------------------------------------------------

	function up()
	{
		$CI =& get_instance();
		
		$data = array('short_name' => 'script_db_version','name' => "Script DB Version",'value' => '2','auto_load' => 'yes');
		$CI->db->insert('settings', $data);

		$data = array('level' => 1);
		$CI->db->update('users', $data);
		
		// Update template to default
		$data = array(
		               'value' => 'default'
		            );

		$CI->db->where('short_name', 'template');
		$CI->db->update('settings', $data);
		
		if ($CI->core_migrate->verbose)
		{
			return "Altering Settings table...";
		}
	}

	// ------------------------------------------------------------------------

	function down()
	{
		$CI =& get_instance();

		$CI->load->dbforge();
		$CI->db->delete('settings', array('short_name' => 'script_db_version')); 
		$CI->db->insert('settings', $data);
		return TRUE;
	}
}
